import React, { Component } from 'react'

export default class TodoItem extends Component {
    onDel = (index) => {
        this.props.cb(index)
    }

    render() {
        return (
            <div>
                <ul>
                    {
                        this.props.list.map((item, index) => {
                            return <li key={index}>{item} <button onClick={() => this.onDel(index)}>x</button></li>
                        })
                    }
                </ul>
            </div>
        )
    }
}